import Vue from 'vue';
import App from './App.vue';
import router from './router';
import axios from "axios";
import store from './store';
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';

Vue.use(ElementUI);
Vue.config.productionTip = false;

router.beforeEach((to, from, next) => {
  // console.log(to);
  // console.log(from);
  // console.log(next);
  if (to.meta.requireAuth) {
    if (store.state.token === localStorage.getItem("party_user")) {
      next();
    } else {
      next("/index/login");
    }
  } else {
    next();
  }
});


new Vue({
  router,
  store,
  render: function (h) {
    return h(App)
  }
}).$mount('#app');
